blktap: fix empty QCOW images (bug 1430 part 2)
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 3 Jun 2009 10:11:50 +0000 (11:11 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 3 Jun 2009 10:11:50 +0000 (11:11 +0100)
commit4b48ffd60a4b9177e90b069024a26ec31f5e9e6b
treec2ddeacc7017b0bd35f107574e2461ba4044c6f7
parent2f78e9cccf5203964043e4b7656da663d9d8e30f
blktap: fix empty QCOW images (bug 1430 part 2)

Empty QCOW images consist of only the L1 table, this results in a
file size which is not sector-aligned. Since blktap uses O_DIRECT, the
block aligned read of the L1 table will go beyond the end of file and
thus returns the actual file size and not the expected length.
This patch checks whether at least the L1 table has been read.

This should fix bug 1430.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
tools/blktap/drivers/block-qcow.c